package com.sounou.swagger2.controller;

import com.sounou.swagger2.param.Param;
import com.sounou.swagger2.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p> Controller </p>
 *
 * @author zengneng@hsyuntai.com
 * @date 2019/3/21 9:00
 * @copyright 版权归 HSYUNTAI 所有
 */
@RestController
@RequestMapping("/controller")
@Api(value = "ControllerValue", tags = {"ControllerTag"})
public class Controller {

    @PostMapping("/foo")
    @ApiOperation(value = "接口描述。。。")
    @ApiImplicitParam(name = "param", required = true, dataType = "Param", value = "参数描述。。。")
    public Result foo(@RequestBody Param param) {
        return Result
                .builder()
                .age(param.getAge() + 1)
                .name("resultName")
                .build();
    }

}
